home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
dskut
/
reform16.zip
/
REFORMAT.IN2
< prev
next >
Wrap
Text File
|
1987-05-22
|
3KB
|
59 lines
(*
REFORMAT.IN2
Inline code for Int25 and Int26 procedures, replaces the original
INT25.ASM and INT26.ASM.
Author David Kirschbaum (ABN.ISCAMS@USC-ISID) May 86.
REFORMAT.PAS author Jos Wennmacker (URC) apr '86.
Since we only use one Register record variable, AND it's a global one,
I stripped out passing its address as a parameter and just rely on it
being in the DS data segment.
*)
PROCEDURE Int2526(R : Byte);
{
Uses global variable Register. Pass $25 (read) or $26 (write)
as R for the function you desire.
}
BEGIN
InLine(
$1E { push ds ;save what we are about to clobber }
/$BE/>Register { mov si,>Register ;load DS:Regs (global) address }
/$8A/$04 { mov al,byte ptr[si] ;Regs.al }
/$8B/$5C/$02 { mov bx,[si+2] ;Regs.bx }
/$8B/$4C/$04 { mov cx,[si+4] ;Regs.cx }
/$8B/$54/$06 { mov dx,[si+6] ;Regs.dx }
/$56 { push SI ;save Regs addr }
/$8B/$74/$0E { mov si,[si+14] ;Regs.DS }
/$8E/$DE { mov ds,si ;DS=Regs.DS }
/$55 { push bp ;DOS destroys it }
/$FC { cld ;if you don't, DOS 2 makes a mess! }
/$80/$BE/>R/$25 { cmp byte ptr >R[BP],$25 ;doing a read? }
/$75/$05 { jne Do26 ;nope }
/$CD/$25 { int $25 ;yep, do the read }
/$E9/$02/$00 { jmp Done ;and skip }
{ Do26: }
/$CD/$26 { int $26 ;do the write }
{ Done: ;old flags are still on the stack! }
/$5F { pop DI ;so save them here a sec }
/$5D { pop BP }
/$5E { pop SI ;Regs addr }
/$1F { pop DS ;Regs seg }
/$9C { pushf ;move the new flags... }
/$8F/$44/$12 { pop [si+18] ;into as Reg.Flags }
/$89/$04 { mov [si],ax ;possible errors }
/$57 { push DI ;old flags.. }
{ ;popf ;..restored }
{ ;one way to evade the older 80286's }
{ ;problem of blowing up during a POPF }
/$E9/$01/$00 { jmp J1 ;skip over IRET }
{ C1: }
/$CF { iret ;pop IP/CS/Flags }
{ J1: }
/$0E { push CS ;make a return }
/$2E { CS: }
/$E8/$FA/$FF { call C1 ;pop the Flags }
);
{ BX,CX,DX should not have changed, so no need to post Regs. }
END; { of Int2526 }